<?php
class AdminsController extends AppController {

	var $scaffold;
	var $name = 'Admins';
	var $components = array('Auth');
	
	
	function beforeFilter()
	{
            $this->Auth->loginError = 'Le login et/ou le mot de passe est incorrect';
            $this->Auth->allow('login');
            $this->Auth->fields = array('username' => 'login','password' => 'password');
	}
	
	function login()
	{
			
		$this->set('title_for_layout', 'Authentification Admin');
                if ($this->Session->read('Auth.Admin')) {
                    $this->Session->setFlash('Tu es connecté !');
                    $this->redirect('/', null, false);
		}
	}
	
	function logout()
	{
		$this->Auth->logoutRedirect = array('controller' => 'pages', 'action' => 'display', 'home');
        $this->Session->setFlash('Au revoir');
        $this->redirect($this->Auth->logout());
	}
}


?>

